package com.mjduan.myBank.util.email.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.mjduan.myBank.user.service.IUserService;
import com.mjduan.myBank.util.logger.MyLogger;

@Controller
@RequestMapping("/email/EmailController")
public class EmailController {
    
	@Autowired
	@Qualifier("UserServiceImpl")
	private IUserService userService;
	
	@RequestMapping(value="emailConfirm")
	public ModelAndView emailConfirm(@RequestParam("id") int id,
			@RequestParam("password") String password){
		MyLogger.info("email收到:id:"+id+"---password:"+password);
		
		userService.updateUserStatusAfterEmailConfirm(id, password);
		/*没有使用绝对定位，带来了很多问题*/
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("/");
		
		return modelAndView;
	}
	
}
